package edu.bbu.license.client.android.services.file.model;

import java.io.File;

public class LocalFile implements FileModel {
	
	private File file;
	
	public LocalFile(File file) {
		this.file = file;
	}
	
	public LocalFile(String path) {
		this.file = new File(path);
	}
	
	public File getRegularFile() {
		return file;
	}

	@Override
	public LocalFile getAncestor() {
		File anchestor = file.getParentFile();
		return anchestor == null ? null : new LocalFile(anchestor);
	}
	
	@Override
	public LocalFile getSuccessor(String child) {
		return new LocalFile(new File(file.getAbsolutePath(), child));	
	}
	
	@Override
	public String getName() {
		return file.getName();
	}
	
	@Override
	public String getAbsolutePath() {
		return file.getAbsolutePath();
	}

	@Override
	public boolean isFile() {
		return file.isFile();
	}

	@Override
	public boolean isDirectory() {
		return file.isDirectory();
	}	
}
